﻿
using FacebookXmpp.Parse;

namespace FacebookXmpp.Stanzas
{
	internal class SuccessFailure : Stanza
    {
        public override string MessageToService()
        {
            return string.Empty;
        }

        public override void ProcessResponse(MessageData recieved)
        {
            if (recieved.Name == "success" || recieved.Name == "failure")
				Stream.AddHandler( new StreamStream( ) );

            if (recieved.Name == "success")
            {
                Stream.Dashboard.IsAuthenticated = true;
                Stream.Dashboard.WorkerState("Authenticated");
            }
            else
            {
                Stream.Dashboard.Errors.Add("Failed to authenticate");
            }

			Stream.RemoveHandler( this );
        }
    }
}
